using Headsight.BPMN2WF.Testing.TestObjCtors;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF.Testing.TestObjCtorsTest
{
    [TestClass]
    public class BPMNSequenceFlowCtorTest
    {
        private BPMNSequenceFlowCtor _sut;

        [TestInitialize]
        public void SetUp()
        {
            _sut = new BPMNSequenceFlowCtor();
        }

        [TestMethod]
        public void Create()
        {
            var actual = _sut.Create();

            Assert.IsNotNull(actual);
        }

        [TestMethod]
        public void WithId_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithId("**id**"));
        }

        [TestMethod]
        public void WithId_Create()
        {
            var actual = _sut.WithId("**id**").Create();

            Assert.AreEqual("**id**", actual.Id);
        }

        [TestMethod]
        public void WithFlowTo_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithFlowTo(new tFlowNodeCtor().Create()));
        }

        [TestMethod]
        public void WithFlowTo_Create()
        {
            var tFlowNode = new tFlowNodeCtor().WithId("**id**").Create();
            
            var actual = _sut.WithFlowTo(tFlowNode).Create();

            Assert.AreEqual("**id**", actual.TElement.targetRef);
        }

        [TestMethod]
        public void WithFlowFrom_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithFlowFrom(new tFlowNodeCtor().Create()));
        }

        [TestMethod]
        public void WithFlowFrom_Create()
        {
            var tFlowNode = new tFlowNodeCtor().WithId("**id**").Create();

            var actual = _sut.WithFlowFrom(tFlowNode).Create();

            Assert.AreEqual("**id**", actual.TElement.sourceRef);
        }
    }
}